package com.jinxin.platform.cdacsrecord.core.controller;

import com.github.pagehelper.PageInfo;
import com.jinxin.platform.cdacsrecord.core.pojo.domains.AcsControlRecordInfo;
import com.jinxin.platform.cdacsrecord.core.service.AcsControlRecordInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * (AcsControlRecordInfo)表控制层
 *
 * @author makejava
 * @since 2020-04-15 09:40:07
 */
@RestController
@RequestMapping("/acsControlRecordInfo")
public class AcsControlRecordInfoController {
    /**
     * 服务对象
     */
    @Resource
    private AcsControlRecordInfoService acsControlRecordInfoService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public AcsControlRecordInfo selectOne(String id) {
        return this.acsControlRecordInfoService.queryById(id);
    }

    @GetMapping("/getTable")
    public Map<String,Object> getTableInfo(int page, int limit,  AcsControlRecordInfo recordInfo,
                                           String beginTime,String endTime, String listenBeginTime, String listenEndTime){
        Map<String,Object> resultMap = new HashMap<>();
        PageInfo<AcsControlRecordInfo> recordInfoPageInfo = acsControlRecordInfoService.queryPageByLimit(page,limit,recordInfo,beginTime,endTime,listenBeginTime,listenEndTime);
        resultMap.put("code","0");
        resultMap.put("msg","");
        resultMap.put("count",recordInfoPageInfo.getTotal());
        resultMap.put("data",recordInfoPageInfo.getList());
        return resultMap;
    }

}